<template>
  <!-- 营销 -->
  <div class="EmergencyDetail">
    <div class="flex location-wrap">
        <span class="white">当前位置：</span>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/EDManagement' }">应急处置 </el-breadcrumb-item>
        <el-breadcrumb-item :to="{ path: '/DisasterSurveyReceiveList' }">灾情勘察</el-breadcrumb-item>
        <el-breadcrumb-item>详情</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="EmergencyDetail-center">
      <TimeLine :title="'应急事件流程'" :activities="actionTimeDataList" />
      <div class="EmergencyDetail-add">
        <div class="EmergencyDetail-titel">
          <div class="EmergencyDetail-top">营销专业灾情现场勘察记录</div>
          <div class="flexBetween">
            <div slot="title" class="flex">
              <div class="leftLine"></div>
              <div class="fontSize16">勘察进度</div>
            </div>
            <el-row>
              <el-button size="mini" @click="AddFh">返回</el-button>
            </el-row>
          </div>
        </div>
        <div class="padding10-0">
          <div class="flexAround fontSize18 margin5-0">
            <div v-for="(item,index) in actionDataList" :key="index">{{item.businessAction}}</div>
          </div>
          <el-steps :active="6" align-center>
            <el-step v-for="(item,index) in actionDataList" :key="index">
              <template slot="icon">
                <span class="yuandian1 ydBgcolor"></span>
              </template>
              <template slot="title">
                <div class="fontWeight textNowrap">{{item.businessTime}}</div>
              </template>
            </el-step>
          </el-steps>
        </div>
        <div class="EmergencyDetail-zt">
          <el-collapse v-model="activeNames">
            <el-collapse-item name="1">
              <div slot="title" class="flex">
                <div class="leftLine"></div>
                <div class="fontSize16">信息来源</div>
              </div>
              <div class="information_Sources_content">
                <div class="task_distribution">
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;响应命令单：<span>{{detailsData.sourceInfo}}</span></div>
                </div>
              </div>
            </el-collapse-item>
            <el-collapse-item name="2">
              <div slot="title" class="flex">
                <div class="leftLine"></div>
                <div class="fontSize16">任务内容</div>
              </div>
              <div class="information_Sources_content">
                <!-- <div class="task_distribution marginB15">
                  <div>任务单名称：{{datas.resourceApplyName}}</div>
                </div> -->
                <div class="task_distribution information">
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;任务单名称：{{detailsData.surveyName}}</div>
                  <div>任务内容：{{detailsData.taskContent}}</div>
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;任务地点：{{detailsData.taskAddress}}</div>
                  <div>派发单位/部门：{{detailsData.distributedUnit}}</div>
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;派发人：{{detailsData.creator}}</div>
                  <div>计划开始时间：{{detailsData.startTime}}</div>
                  <div>责任单位/部门：{{detailsData.dutyUnit}}</div>
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;责任人：{{detailsData.dutyOfficer}}</div>
                  <div>计划结束时间：{{detailsData.endTime}}</div>
                </div>
                <!-- <div class="task_distribution">
                  <div>需求描述：{{datas.applyDescription}}</div>
                </div> -->
              </div>
            </el-collapse-item>
            <el-collapse-item name="3">
              <div slot="title" class="flex">
                <div class="leftLine"></div>
                <div class="fontSize16">勘察记录</div>
              </div>
              <div class="information_Sources_content">
                <!-- <div class="task_distribution marginB15">
                  <div>任务单名称：{{datas.resourceApplyName}}</div>
                </div> -->
                <div class="task_distribution information" v-for="(res,index1) in detailsRecordsList" :key="index1">
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;勘察单位：{{res.surveyUnit}}</div>
                  <div>部门/班组：{{res.department}}</div>
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;勘察地点：{{res.surveyAddress}}<span style="margin-left: 6px;font-size:20px;"><i class="el-icon-location-outline"></i></span></div>
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;勘察负责人：{{res.surveyLeader}}</div>
                  <div>勘察人员：{{res.surveyMember}}</div>
                  <div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;专业：{{res.major}}</div>
                  <div>勘察详情：{{res.surveyDetails}}</div>
                  <div>工作附件：<img src="res.workAttach" alt=""></div>
                </div>
                <!-- <div class="task_distribution">
                  <div>需求描述：{{datas.applyDescription}}</div>
                </div> -->
              </div>
              <div class="EmergencyList-table">
                <div style="margin: 6px 0px 6px 30px;font-weight: 600;">物资需求</div>
                <el-table border :header-cell-style="{ background:'#B1C8F9',color:'#000000', border: '1px solid #ccc'}" ref="multipleTable" :data="detailsPlans" max-height="500px" tooltip-effect="dark" style="width: 100%" size="small">
                  <!-- <el-table-column type="index" label="序号" width="80" align="center">
                  </el-table-column> -->
                  <el-table-column prop="suppliesName" label="物资名称" align="center">
                  </el-table-column>
                  <el-table-column prop="suppliesDesc" label="物资描述" align="center">
                  </el-table-column>
                  <el-table-column prop="perUnit" label="单位" align="center">
                  </el-table-column>
                  <el-table-column prop="number" label="数量" align="center">
                  </el-table-column>
                </el-table>
              </div>
            </el-collapse-item>
          </el-collapse>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import TimeLine from "@/components/component/timeLine.vue";
import { zqkcFeedbackGetRecordById, zqkcFeedbackAction, getFlowListAction } from "@/api/EmergencyDisposal/zqkc.js";
export default {
  name: "EmergencyDetail",
  components: { TimeLine },
  data() {
    return {
      activeNames: ["1", "2", "3", "4", "5"],
      actionDataList: [], // 进度
      detailsData: {},
      detailsRecordsList: [], // 勘察记录
      detailsPlans: [],
      // activities: [
      //   {
      //     flowName: "应急事件上报",
      //     flowTime: "2021-09-28 18:00:00",
      //     color: "rgb(37, 109, 252)"
      //   },
      //   {
      //     flowName: "灾情统计",
      //     flowTime: "2021-09-28 18:00:00",
      //     color: "rgb(37, 109, 252)"
      //   },
      //   {
      //     flowName: "响应研判",
      //     flowTime: "2021-09-28 18:00:00",
      //     color: "rgb(37, 109, 252)"
      //   },
      //   {
      //     flowName: "响应命令单发布",
      //     flowTime: "2021-09-28 18:00:00",
      //     color: "rgb(37, 109, 252)"
      //   },
      //   {
      //     flowName: "应急指挥部成立",
      //     flowTime: "2021-09-28 18:00:00",
      //     color: "rgb(37, 109, 252)"
      //   },
      //   {
      //     flowName: "营销专业灾情现场勘察记录",
      //     flowTime: "2021-09-28 18:00:00",
      //     color: "rgb(37, 109, 252)"
      //   }
      // ],
      actionTimeDataList: []

    };
  },
  mounted() {
    this.loadActionTime();
    this.loadAction(this.$route.query.id);
    this.GetApplyDetails(this.$route.query.id);
  },
  methods: {
    // 勘察进度
    async loadAction(id) {
      const res = await zqkcFeedbackAction({ id });
      console.log(res.data);
      this.actionDataList = res.data;
    },
    // 勘察进度 左侧时间轴
    async loadActionTime() {
      const res = await getFlowListAction({ emergencyId: this.$route.query.emergencyId });
      console.log(res.data);
      this.actionTimeDataList = res;
    },

    // 详情
    async GetApplyDetails(id) {
      const res = await zqkcFeedbackGetRecordById({ id });
      this.detailsData = res.base;
      console.log(this.detailsData);
      this.detailsRecordsList = res.records;
      console.log(this.detailsRecordsList);
      // this.detailsDataListBd = res.bdDamaged // 设备受损
      this.detailsPlans = res.plans; // 物资需求计划
    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 1 || columnIndex === 9 || columnIndex === 10) {
        if (rowIndex % 5 === 0) {
          return {
            rowspan: 5,
            colspan: 1
          };
        } else {
          return {
            rowspan: 0,
            colspan: 0
          };
        }
      }
    },
    tableRowClassName({ rowIndex }) {
      if (rowIndex % 2 === 1) {
        return "white-row";
      }
      return "";
    },
    // 返回上一级
    AddFh() {
      this.$router.go(-1);
    }
  }
};
</script>

<style scoped lang="less">
.EmergencyDetail {
  width: 100%;
  height: 100%;
  :deep(.el-timeline) {
    width: 85%;
    margin-left: 35px;
    margin-top: 30px;
  }
  :deep(.el-breadcrumb__inner.is-link) {
    font-weight: 100;
    color: #fff;
  }
  :deep(.el-breadcrumb__item:last-child .el-breadcrumb__inner) {
    color: #3270ff;
  }
  :deep(.el-breadcrumb) {
    font-size: 16px;
    line-height: initial;
  }
  .EmergencyDetail-center {
    width: 100%;
    height: 100%;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    .EmergencyDetail-add {
      width: 83%;
      height: 100%;
      background-color: #fff;
      border-radius: 5px;
      overflow: auto;
      .EmergencyDetail-titel {
        margin: 0 20px;
        position: relative;
        padding: 10px 0 5px 0;
        border-bottom: solid 1px #ccc;
        .EmergencyDetail-top {
          text-align: center;
          font-family: 微软雅黑;
          font-weight: 400;
          font-style: normal;
          font-size: 28px !important;
        }
      }
      .EmergencyDetail-zt {
        overflow-y: auto;
        margin: 0 20px;
        font-size: 16px;
        :deep(.el-button--text) {
          color: #606266;
          padding: 2px;
        }
        .EmergencyList-dialog-form-item {
          display: flex;
          justify-content: space-between;
          flex-wrap: wrap;
        }
        .task_distribution {
          display: flex;
          align-items: center;
          padding: 0 30px;
          span {
            color: #3561fd;
            text-decoration: underline;
          }
        }
        .task_distribution.information {
          flex-wrap: wrap;
          div {
            width: 33%;
            margin-bottom: 12px;
            align-items: center;
            img {
              position: relative;
              top: 5px;
              left: 10px;
            }
          }
        }
      }
    }
  }
}
:deep(.el-step__icon.is-text) {
  border: none;
}
:deep(.el-collapse-item__content) {
  padding-top: 5px;
  padding-bottom: 10px;
  font-size: 16px;
}
.yuandian1 {
  display: inline-block;
  background-color: #ccc;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.ydBgcolor {
  background-color: #246dfd;
  box-shadow: 0px 0px 8px 0px rgb(10, 99, 241);
}
.EmergencyList-table-pag {
  float: right;
  margin-top: 10px;
  > div {
    line-height: 32px;
  }
}
:deep(.el-table) {
  font-size: 16px;
  tr {
    > :last-child {
      padding: 0;
      img {
        display: block;
        margin: auto;
      }
    }
  }
  .white-row {
    background: #f0f2f5;
  }
}
:deep(.el-collapse-item__header) {
  border-bottom: 1px solid #ccc;
}
:deep(.el-collapse-item__content) {
  padding: 15px 0;
}
:deep(.el-collapse-item__wrap) {
  border: none;
}
.grid-content {
  background-color: #b1c8f9;
  border: 1px solid #d7d7d7;
  text-align: center;
  padding: 8px 0;
}
.grid-content.bottom_col {
  background-color: #f0f2f5;
  border: 1px solid #d7d7d7;
}
.grid-content.top_col {
  background-color: #fff;
  border-top: none;
  border-bottom: none;
}
</style>
